package com.rtx.edi.platform.express.auth.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rtx.edi.platform.express.auth.service.TokenService;
import com.rtx.edi.platform.express.auth.service.WaybillService;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.CainiaoWaybillIiSearchRequest;
import com.taobao.api.response.CainiaoWaybillIiSearchResponse;
/**
 * 获取平台授权信息订购关系
 * @author luoqiongli
 *
 */
@Service
public class WaybillServiceImpl implements WaybillService {
	
	@Autowired
	private  TokenService tokenService;
	

	@Override
	public CainiaoWaybillIiSearchResponse getTbWaybill(String getway, String appkey, String appsecret,String authcode, String cpCode) throws Exception {
		
		TaobaoClient client = new DefaultTaobaoClient(getway, appkey, appsecret);
		CainiaoWaybillIiSearchRequest req = new CainiaoWaybillIiSearchRequest();
		if(null!=cpCode) {
			req.setCpCode(cpCode);
		}
		String  token=tokenService.getTbtoken(getway, appkey, appsecret, authcode);
		CainiaoWaybillIiSearchResponse rsp = client.execute(req, token);
		return rsp;
	}

	@Override
	public Object getDyWaybill() {
		
		
		
		return null;
	}

	@Override
	public Object getPddWaybill() {
		
		
		return null;
	}

	@Override
	public Object getJdWaybill() {
		
		
		return null;
	}

	@Override
	public Object getXhsWaybill() {
		
		
		return null;
	}

	@Override
	public Object getKsWaybill() {
		
		
		return null;
	}

}
